<!DOCTYPE html>
<html lang="zh-CN">

{% include 'header.html' %}

    <body>
        <!--头部-->
        <header class="site-header">
            <div class="header-main container">
                <div class="row">
                    <div class="col-xs-12">
                        <h2>视频&nbsp;<a href="/"><img src="/static/img/logo.png" alt="OJBK视频解析" class=""></a>&nbsp;解析</h2>
                        <form action="/api" method="post" onsubmit="return false;">
                            <div class="form-group form-group-lg input-group input-group-lg">
                                <input type="text" id="url_input" name="url" class="form-control" autocomplete="off" placeholder="请输入视频地址，如：http://yakul-fox.tumblr.com/post/158468244987/">
                                <span class="input-group-btn" id="url_submit">
                <button class="btn btn-default btn-warning" type="button" id="url_submit_button" title="视频解析">
                  <span class="glyphicon glyphicon-arrow-right" id="url_submit_icon" aria-hidden="true"></span>
                                </button>
                                </span>
                            </div>
                        </form>
                    </div>
                    <div class="lead col-xs-12" id="adtop">
                    </div>
                </div>
            </div>
            <!--分享插件 -->
            <div class="addthis_inline_share_toolbox"></div>
            <!--分享插件 -->
        </header>
        <!--头部-->
        <hr/>
        <!--内容部分-->
        <div class="site-middle container">
            <!--窗口提示-->
            <div id="message">
                <div class="alert alert-warning alert-dismissible fade in {#hidden-xs#}" role="alert">
                    记住本站: <code>{{domain}}</code>完全OJBK;
                    <p>tips：</p><p>1. 如果不会使用，直接点击下方链接，再点击 <span class="glyphicon glyphicon-arrow-right" id="url_submit_icon" aria-hidden="true"></span>试试</p>
                          <p>2. 如果不能解析，对比输入的链接形式是否和下方示例链接格式相同？</p>
                </div>
            </div>
            <!--窗口提示-->
            <!--视频信息部分-->
            <div id="video" style="display:none;"></div>
            <div class="panel" id="admid">
            </div>
            <!--视频信息部分-->
            <!--列表部分-->
            <nav class="navbar navbar-default">
                <div class="container-fluid">
                    <div class="navbar-header">
                        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse" aria-expanded="false">
                            <span class="sr-only">Toggle</span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                        <a class="navbar-brand" href="javascript:void(0);">支持列表:</a>
                    </div>
                    <div class="collapse navbar-collapse" id="navbar-collapse">
                        <ul class="nav navbar-nav navbar-right">
                            <li class="active">
                                <a href="#video_tab_ec5321a9b3aedf1e7010608999263a68" data-toggle="tab">综合视频</a>
                            </li>
                        </ul>
                    </div>
                </div>
            </nav>
            <div class="  tab-content">
                <div class=" tab-pane fade in active" id="video_tab_ec5321a9b3aedf1e7010608999263a68">
                    <table class="table table-hover table-condensed table-striped table-bordered">
                        <tr>
                            <th class="text-center">
                                <a class="left-title" href="javascript:void(0);">tumblr（汤不热）</a>
                            </th>
                            <td class="bs-callout bs-callout-info">
                                <div class="list-unstyled list-group up-list">
                                    批量解析<a class="list-group-item get-link" href="#http://yakul-fox.tumblr.com/">http://yakul-fox.tumblr.com/</a> 单个解析
                                    <a class="list-group-item get-link" href="#http://yakul-fox.tumblr.com/post/158468244987/">http://yakul-fox.tumblr.com/post/158468244987/</a>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <th class="text-center">
                                <a class="left-title" href="javascript:void(0);">91porn</a>
                            </th>
                            <td class="bs-callout bs-callout-info">
                                <div class="list-unstyled list-group up-list">
                                    91porn只认<code>91porn.com</code>域名
                                    <a class="list-group-item get-link" href="#{{porn91}}/view_video.php?viewkey=97362de1f700847213a0">{{porn91}}/view_video.php?viewkey=97362de1f700847213a0</a>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <th class="text-center">
                                <a class="left-title" href="javascript:void(0);">恋恋影视（2mm）</a>
                            </th>
                            <td class="bs-callout bs-callout-info">
                                <div class="list-unstyled list-group up-list">
                                    恋恋影视域名较多，只认<code>{{mm2}}</code>域名
                                    <a class="list-group-item get-link" href="#{{mm2}}/m286">{{mm2}}/m286</a>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <th class="text-center">
                                <a class="left-title" href="javascript:void(0);">微博批量解析</a>
                            </th>
                            <td class="bs-callout bs-callout-info">
                                <div class="list-unstyled list-group up-list">
                                    <a class="list-group-item get-link" href="#@美少女写真馆">@美少女写真馆</a>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
            <!--列表部分-->
            <div class="panel" id="adbot"></div>
            <!--列表部分-->
        </div>
        <!--内容部分-->
        <!--底部-->
        {% include 'footer.html' %}
        <a href="#" id="back-to-top"><i class="fa fa-angle-up"></i></a>
        <!--底部-->
        <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
        <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
        <!-- Include all compiled plugins (below), or include individual files as needed -->
        <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
        <script src="https://cdn.bootcss.com/clipboard.js/1.6.1/clipboard.min.js"></script>
        <script src="https://cdn.bootcss.com/fancybox/2.1.6/js/jquery.fancybox.min.js"></script>
        <script src="https://cdn.bootcss.com/jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
        <script src="https://cdn.bootcss.com/ekko-lightbox/5.1.1/ekko-lightbox.min.js"></script>
        <script src="https://cdn.bootcss.com/jquery-url-parser/2.3.1/purl.min.js"></script>
        <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=xsales"></script>
        <script type="text/javascript">
        $(document).on('click', '[data-toggle="lightbox"]', function(event) {
            event.preventDefault();
            $(this).ekkoLightbox({ alwaysShowClose: true, });
        });
        $(function() {
            //导航文本框获取链接
            var url = $(location).attr('hash').replace('#', '');
            if (url) {
                $("#url_input").attr("value", url);
            }
            /* 双击清空网址输入框 */
            $("#url_input").dblclick(
                function() {
                    $("#url_input").val('');
                }
            );
            /* 单击选择网址输入框 */
            $("#url_input").click(
                function() {
                    $(this).select();
                }
            );
            //点击链接到输入框
            $(".get-link").click(function() {
                var get_url = $(this).text();
                //$("#url_input").attr("value",get_url);
                $("#url_input").val(get_url);
                $('html, body').animate({
                    scrollTop: $(".site-header").offset().top
                }, 100).end();
            });
            //$("#get-video").attr('src',vod_url);
            //回车事件
            $(document).keydown(function(event) {
                if (event.keyCode == "13") {
                    $("#url_submit").trigger("click");
                }
            });
            //返回顶部事件
            $(window).scroll(function() {
                $(this).scrollTop() > 100 ? $("#back-to-top").fadeIn() : $("#back-to-top").fadeOut();
            });
            $("#back-to-top").on("click", function() {
                $("html, body").animate({ scrollTop: 0 }, 1000);
            });
            //ajax提交数据
            $("#url_submit_button").click(function() {
                $("#message").html("");
                $("#video").fadeOut("slow");
                window.location.href = "#" + $("#url_input").val();
                var url = $("#url_input").val();
                var host = $.url(url).attr('host');
                var hash = "{{hash_}}";
                $("#url_submit_icon").attr("class", "fa fa-spinner fa-pulse fa-lg");
                $("#url_submit_button").attr("disabled", "disabled");
                /* 如果为空弹出提示 */
                if (!url) {
                    $("#message").html("<div class=\"alert alert-warning alert-dismissible fade in\" role=\"alert\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">&times;</span></button>请输入正确的解析网址！</div>");
                    $("#url_submit_icon").attr("class", "glyphicon glyphicon-arrow-right");
                    $("#url_submit_button").removeAttr("disabled");
                } else {
                    $.ajax({
                        type: "POST",
                        url: "/api",
                        data: { url: url, hash: hash },
                        dataType: "json",
                        //jsonp: "callback",
                        success: function(result) {
                            console.log(result);
                            if (result.captcha != undefined && result.captcha == 'ok') {
                                $('#captcha').modal();
                                $("#captcha_img").attr("src", './captcha?' + Math.random());
                                $("#message").html("<div class=\"alert alert-warning alert-dismissible fade in\" role=\"alert\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">&times;</span></button>为了防止自动化程序非授权使用本站接口，请输入验证码！</div>");
                            }
                            if (result.status == 'ok' && result.total != 0) {
                                var video_html = "<div class=\"panel panel-success\">";
                                if (result.pages == 2) {
                                    video_html += result.html;
                                }
                                video_html += "<div class=\"panel-heading\"><h3 class=\"panel-title\">视频列表：</h3></div><ul class=\"list-group\">";
                                $.each(result.video, function(i) {
                                    video_html += "<li class=\"list-group-item\"><p class=\"input-group\"><input type=\"text\" name=\"search\" id=\"video" + i + "\" class=\"form-control get-text\" value=\"" + result.video[i].url + "\"><span class=\"input-group-btn\"><a href=\"javascript:void(0);\" class=\"btn btn-info btnCopy\" data-clipboard-action=\"copy\" data-clipboard-target=\"#video" + i + "\" ><span class=\"glyphicon glyphicon-duplicate\"></span></a><a href=\"" + result.video[i].url + "\" class=\"btn btn-primary get-dowmload\" download=\""+result.video[i].desc+".mp4\" role=\"button\" title=\"下载\" ><span class=\"glyphicon glyphicon-save\"></span></a><a href=\"" + result.video[i].url + "\" class=\"btn btn-success\" role=\"button\" title=\"播放\"  data-toggle=\"lightbox\" data-title=\"\" data-type=\"video\" data-width=\"1024\"><span class=\"glyphicon glyphicon-play\"></span></a><a class=\"btn btn-default btn-warning hidden-xs\" title=\"扫码看视频\" onclick=\"$.fancybox.open('<div id=\\\'qrcode\\\'></div>');$('#qrcode').qrcode({text:'" + result.video[i].url + "'});\"><span class=\"fa fa-qrcode\"></span></a></span></p><p class=\"get-desc\">简介：" + result.video[i].desc + "</p></li>";
                                });
                                video_html += "</ul></div>";
                                $("#video").html(video_html);
                                //淡出搜索内容
                                $("#video").fadeIn("slow");
                                //选中文本

                                $(".get-text").click(function() {
                                    $(this).select();
                                });
                                //复制内容
                                var clipboard = new Clipboard('.btnCopy');
                                clipboard.on('success', function(e) {
                                    $('.btnCopy').tooltip({
                                        delay: {
                                            show: 100,
                                            hide: 500,
                                        },
                                        trigger: 'hover|click',
                                        title: '复制成功！'
                                    });

                                });
                                clipboard.on('error', function(e) {
                                    $('.btnCopy').tooltip('destroy');
                                });
                            } else {
                                $("#video").fadeOut("slow");
                                $("#message").html("<div class=\"alert alert-warning alert-dismissible fade in\" role=\"alert\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">&times;</span></button>" + result.message + "</div>");
                            }

                            $("#url_submit_icon").attr("class", "glyphicon glyphicon-arrow-right");
                            $("#url_submit_button").removeAttr("disabled");
                        }
                    });

                }
            });
            $("#captcha_img").click(function() {
                $(this).attr("src", './captcha?' + Math.random());
            });
            $("#captcha_code").click(function() {
                $(this).val("");
            });
            $("#captcha_sbumit").click(function() {
                $.post("/api", $("#captcha_form").serialize(), function(result) {
                    $("#captcha_code").val("");
                    if (result.captcha == "pass") {
                        $('#captcha').modal('hide');
                        $("#url_submit_button").click();
                    } else {
                        $("#captcha_img").attr("src", './captcha?' + Math.random());
                    }
                }, "json");
            });
        });
        </script>
        <div class="modal fade" id="captcha" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title" id="myModalLabel">请输入验证码</h4>
                    </div>
                    <div class="modal-body">
                        <form class="form-inline" id="captcha_form">
                            <div class="form-group">
                                <img src="" alt="点击刷新" id="captcha_img">
                            </div>
                            <div class="form-group">
                                <input type="text" name="captcha_code" class="form-control input-lg" id="captcha_code" placeholder="请输入验证码">
                            </div>
                            <button type="button" class="btn btn-primary btn-lg" id="captcha_sbumit">提交验证</button>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </body>

</html>
